#include "CameraEncoder.h"
#include "VideoProcesser.h"
#include "DataProcess.h"
#include "ui_CameraEncoder.h"

CameraEncoder::CameraEncoder(QWidget *parent)
	: QMainWindow(parent), ui(new Ui::CameraEncoderClass)
{
	ui->setupUi(this);
	connect(ui->connBtn, &QPushButton::clicked, [&](){
		if (m_bConnect)
		{
			return;
		}

		m_bConnect = DNetClient::getInstance()->connectServer();
		ui->connInfo->setText(m_bConnect ? "ok" : "failed");
		if (m_bConnect)
		{
			m_pVideoProcesser = new CVideoProcesser();
			m_pVideoProcesser->start();
		}
	});
}

CameraEncoder::~CameraEncoder()
{
	m_pVideoProcesser->stopThread();
}